<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>博客类型管理</title>
	<link href="bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet" th:href="@{/bootstrap-3.3.7-dist/css/bootstrap.min.css}">
    <link href="css/common.css" rel="stylesheet" th:href="@{/css/common.css}">
    <script type="text/javascript" src="js/jquery-1.12.4.min.js" th:src="@{/js/jquery-1.12.4.min.js}"></script>
    <script src="bootstrap-3.3.7-dist/js/bootstrap.min.js" th:src="@{/bootstrap-3.3.7-dist/js/bootstrap.min.js}"></script>
          <script src="/My97DatePicker/WdatePicker.js" type="text/javascript" th:src="@{/My97DatePicker/WdatePicker.js}"></script>
    <script src="jquery-validation-1.14.0/lib/jquery.js" th:src="@{/jquery-validation-1.14.0/lib/jquery.js}"></script>
    <script src="jquery-validation-1.14.0/dist/jquery.validate.min.js" th:src="@{/jquery-validation-1.14.0/dist/jquery.validate.min.js}"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#inputForm").validate({
			rules : {
				name: {
					required : true
				},
				type: {
					required : true
				},
				showType:{
					required : true
				},
			},
			messages : {
				name: {
					required : "名称必填"
				},
				type: {
					required : "类型必填"
				},
				showType:{
					required : "显示形式必填"
				},
			}
		})
		});
		
		function showDiv() {
			var a = $("#type").val();
			if("1"==a){
				$("#showType").show()
			}else
				$("#showType").hide()
		}
		
	</script>
</head>
<body>
	<div class="container-fluid"><br>
	<form id="inputForm" action="/admin/cms/blogType/save" method="post" class="form-horizontal"  enctype="multipart/form-data">
		<input type="hidden" name="id" th:value="${blogType.id}" />
			
			<div class="form-group" id="name">
				<label for="name" class="col-sm-1 control-label">名称<b class="error">*</b></label>
   				<div class="col-sm-6">
			
						 <input name="name" th:value="${blogType.name}" maxlength="255" class="form-control"/>
				</div>
			</div>
			
			<div class="form-group" id="type_div">
				<label for="type" class="col-sm-1 control-label">类型<b class="error">*</b></label>
   				<div class="col-sm-6">
					<select id="type" name="type" class="form-control" onchange="showDiv();">
						<option value="">请选择</option>
						<option value="1" th:selected="${blogType.type=='1'}">博客类别</option>
						<option value="2" th:selected="${blogType.type=='2'}">博客标签</option>
					</select>
				</div>
			</div>

		<div id="showType" class="form-group">
			<label for="showType" class="col-sm-1 control-label">类型<b class="error">*</b></label>
			<div class="col-sm-6">
				<select name="showType" class="form-control">
					<option value="">请选择</option>
					<option value="1" th:selected="${blogType.showType=='1'}">列表形式</option>
					<option value="2" th:selected="${blogType.showType=='2'}">图片形式</option>
				</select>
			</div>
		</div>
			<div class="form-group" id="firstname">
				<label for="firstname" class="col-sm-1 control-label"></label>
   				<div class="col-sm-6">
					<button class="btn btn-success" type="submit">保 存</button>
					<button class="btn btn-inf" type="button" onclick="javascript:history.go(-1);">返 回</button>
				</div>
			</div>
	</form>
	</div>
</body>
</html>